home *** CD-ROM | disk | FTP | other *** search
/ Super PC 34 / Super PC 34 (Shareware).iso / spc / UTIL / DJGPP2 / V2 / DJTST200.ZIP / tests / libc / go32 / raise.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-09-06  |  326 b   |  24 lines

  1. #include <stdio.h>
  2. #include <signal.h>
  3.  
  4. void
  5. sf(int x)
  6. {
  7.   printf("FPU exception trapped!\n");
  8.   exit(1);
  9. }
  10.  
  11. int
  12. main(void)
  13. {
  14.  
  15.   if (signal(SIGFPE, sf) == SIG_ERR)
  16.     printf("cannot set signal handler\n");
  17.  
  18.   printf("before the raise\n");
  19.   raise(SIGFPE);
  20.   printf("after the raise\n");
  21.  
  22.   return 0;
  23. }
  24.